package net.htjs.jdkgrammer.jdk19;

import java.util.concurrent.TimeUnit;

public class StartVirtualThreadTest {

    public static void main(String[] args) throws InterruptedException {
        //创建任务
        Runnable task = () -> {
            System.out.println("执行任务");
        };

        //创建虚拟线程将任务task传入并启动
        Thread.startVirtualThread(task);

        //主线程睡眠，否则可能看不到控制台的打印
        TimeUnit.SECONDS.sleep(1);

    }
}
